﻿using Newtonsoft.Json.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SocialPlatforms;

public class ToggleDevice : DeviceBase
{
    const string STATE_RUNNING = "running";

    private bool _baseValue = false;
    public bool Value { get; set; }
    public bool IsPressed
    {
        get
        {
            return Value != _baseValue;
        }
    }

    public override void Clear()
    {
        _baseValue = Value;
    }

    public override void ClearToMax()
    {
        Value = true;
        Clear();
    }

    public override void ClearToMin()
    {
        Value = false;
        Clear();
    }

    public override string GetDeviceStatusCore()
    {
        var iVal = IsPressed  ? 1 : 0;
        return $"{STATE_RUNNING},{iVal}";
    }
}
